<template>
	<view>
		<view class="title">
			<view style="margin-left: 10upx;">
				<view style="margin-top: 40upx;">
					<text class="nickname">{{userInfo.nickname}}</text>
					<!-- <text class="location">山西·高平</text><br /> -->
					<text class="phone">{{userInfo.mobile}}</text>
				</view>
				<view style="margin-top: 30upx;">
					<text style="font-size: 30upx;">余额(元)</text><br />
					<text style="font-size: 56upx;font-weight: 500; color: #D7000F;">{{balanceInfo.balance}}</text>
				</view>
			</view>
			<image :src="userInfo.avatar?userInfo.avatar:defaultImg" class="head-img"></image>
		</view>
		<view class="num">
			<!-- <text class="cash" @click="tobankcard">提现到银行卡</text> -->
			<!-- <text>|</text> -->
			<text class="cash" @click="tocommission">我要提现</text>
			<text>|</text>
			<text class="cash" @click="towithdraeal" style="border: 0;">提现明细</text>
		</view>
		<view class="box">
			<view class="pox" style="background: #756bff;">
				<view class="dom">
					<image class="img" src="../../static/images/tixian1.png"></image>可提现
				</view>
				<text class="uni-text">{{disUserEntity.canDrawMoney}}</text>
			</view>
			<view class="pox" style="background: #fdc178;">
				<view class="dom">
					<image class="img" src="../../static/images/tixian1.png"></image>已提现
				</view>
				<text class="uni-text">{{disUserEntity.drawedMoney}}</text>
			</view>
			<view class="pox" style="background: #8ecaff;">
				<view class="dom">
					<image class="img" src="../../static/images/tixian1.png"></image>未结算
				</view>
				<text class="uni-text">{{disUserEntity.noSettlementMoney>=0?disUserEntity.noSettlementMoney:'0'}}</text>
			</view>
		</view>
		<view class="list" @click="toFxOrder">
			<view style="display: flex;">
				<image class="image" src="../../static/icon/fxorder.png"></image>
				<text style="line-height: 70upx;">我的订单</text>
			</view>
			<!-- <view style="text-align: right;">
				<p>{{result.length}}</p>
				<p style="color: #D7000F;">订单数量</p>
			</view> -->
		</view>
		<view class="list" @click="toMyTeam">
			<view style="display: flex;">
				<image class="image" src="../../static/icon/team.png"></image>
				<text style="line-height: 70upx;">我的团队</text>
			</view>
			<!-- <view style="text-align: right;">
				<text>{{array.length}}(人)</text><br />
				<text style="color: #D7000F;">总计</text>
			</view> -->
		</view>
	</view>
</template>
<script>
	import {
		get,
		post,
		showToast
	} from '../../js/common';
	export default {
		data() {
			return {
				array: {},
				userInfo: {},
				balanceInfo: {},
				userId: '',
				page: '',
				limit: '',
				result: [],
				disUserEntity: {},
				defaultImg: '/static/logo.png'
			}
		},
		onLoad() {
			this.getuserinfo()
			this.getUserDisBalance()
		},
		methods: {
			getuserinfo() {
				try {
					this.accesstoken = uni.getStorageSync('token')
					this.userId = uni.getStorageSync('userId')
					const params = {
						userId: this.userId
					}
					post('mobileapi/mobile/member/usercenter/showUserInfo', params).then(res => {
						this.userInfo = res.userinfo.userInfo
						this.balanceInfo = res.userinfo.balanceInfo
					})
				} catch (e) {}
			},
			getshowDisOrder() {
				try {
					// 				this.accesstoken = uni.getStorageSync('token')
					this.userId = uni.getStorageSync('userId')
					const params = {
						userId: this.userId,
					}
					post('mobileapi/pcdis/showDisOrder', params).then(res => {})
				} catch (e) {}
			},
			getregion() {
				try {
					this.accesstoken = uni.getStorageSync('token')
					this.regionId = uni.getStorageSync('regionId')
					const params = {
						id: this.userId,
					}
					post('mobileapi/mobile/member/usercenter/showUserAddress', params).then(res => {})
				} catch (e) {}
			},
			getTeamByUserId() {
				const params = {
					userId: this.userId
				}
				post('mobileapi/pcdis/getTeamByUserId', params).then(res => {
					this.array = res.data
				})
			},
			getUserDisBalance() {
				const params = {
					userId: this.userId,
				}
				post('mobileapi/pcdis/getUserDisBalance', params).then(res => {
					if (res.disUserEntity) {
						this.disUserEntity = res.disUserEntity
					}else{
						this.disUserEntity = {
							canDrawMoney:0,
							drawedMoney:0,
							noSettlementMoney:0
						}
					}
				})
			},
			tobankcard() {
				uni.navigateTo({
					url: "/pages/bankcard/index"
				})
			},
			tocommission() {
				
				uni.navigateTo({
					url: "/pages/commission/Commission"
				})
			},
			toFxOrder() {
				uni.navigateTo({
					url: "/pages/fxorder/index"
				})
			},
			toMyTeam() {
				uni.navigateTo({
					url: "/pages/team/index"
				})
			},
			towithdraeal() {
				uni.navigateTo({
					url: "/pages/withdraeal/index"
				})
			}
		},
	}
</script>
<style>
	page {
		background-color: #FFFFFF;
	}

	.title {
		display: flex;
		justify-content: space-between;
		padding: 20upx;
	}

	.nickname {
		font-size: 60upx;
	}

	.location {
		color: #F2F2F2;
		font-size: 24upx;
		background: #9ac7f1;
		border-radius: 5px;
		margin-left: 10px;
		padding: 4upx 10upx;
	}

	.phone {
		font-size: 30upx;
	}

	.balance {
		font-size: 28upx;
	}

	.head-img {
		width: 150upx;
		height: 150upx;
		border-radius: 50%;
		border: 1px solid #FFFFFF;
		margin: 10px;
	}

	.num {
		display: flex;
		font-size: 28upx;
		padding: 10px;
	}

	.cash {
		flex: 1;
		text-align: center;
	}

	.box {
		height: 180upx;
		border-top: 1px solid #E6E6E6;
		border-bottom: 1px solid #E6E6E6;
		font-size: 24upx;
		display: flex;
	}

	.pox {
		text-align: center;
		color: #FFFFFF;
		margin: auto 14upx;
		flex: 1;
		height: 140upx;
		box-shadow: 0px 0px 4px 0px rgba(22, 29, 69, 0.15);
	}

	.dom {
		margin: 5px;
		display: flex;
		text-align: left;
	}

	.img {
		margin-right: 3px;
		width: 30upx;
		height: 30upx;
	}

	.uni-text {
		font-size: 50upx;
		color: #FFFFFF;
	}

	.list {
		height: 70upx;
		padding: 20upx;
		font-size: 28upx;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #E0E0E0;
	}

	.image {
		width: 36upx;
		height: 36upx;
		margin: 18upx 10upx;
	}
</style>
